//数据类型验证
import {customeStruct} from '../utils';
const itf = customeStruct.interface;

export const InitData = itf({
    payload: itf({
        isDealerUser: 'boolean',
        brands: [
            itf({
                id: 'string',
                code: 'string',
                name: 'string',
            })
        ],
        partSaleOrderTypes: [
            itf({
                id: 'string',
                typeCode: 'string',
                typeName: 'string',
            })
        ]

    })
});

export const List = itf({
    payload: itf({
        content: [itf(Object.assign({
            id: 'string',
            dealerCode: 'string?|null',
            code: 'string?|null',
            partOrderTypeId: 'string?|null',
            transportType: 'number?|null',
            submitTime: 'string?| null',
            status: 'number?|null',
            totalAmount: 'number?|null',
            amountMeetFullRate: 'number?|null',
            partInvoiceCode: 'string?|null',
            delivedDate: 'string?|null',
            currency: 'number?|null',
            rowVersion: 'string',
            options: 'array'
        }))],
        totalElements: 'number',
    })
});

export const Detail = itf({
    payload: itf({
        id: 'string',
        partInvoices: [
            itf({
                partInvoiceCode: 'string',
                itemCount: 'number?|null',
                totalAmount: 'number?|null',
                amountMeetRate: 'number?|null',
                quantityMeetRate: 'number?|null',
            })
        ],
        rowVersion: 'string'
    })
});

export const BackOrderDetail = itf({
    payload: itf({
        partInvoiceId: 'string',
        code: 'string?|null',
        partSaleOrderCode: 'string?|null',
        oldPartCode: 'string?|null',
        rowVersion: 'string',
    })
});

